<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
  <head>
    <link rel="shortcut icon" href="http://localhost:8080${pageContext.request.contextPath}/img/logo.jpg">
    <title>任务详情列表</title>
<!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
    <style type="text/css">
        /* 选择器：1.标签 2.class 3.id */
        .lbimg{
            width: 100%;
        }
        .dvfooter{
            position: absolute;
            bottom: 2px;
            height: 40px;
            background-color: #0062CC;
            width: 100%;
        }
        /*表单样式*/
        #form{
            margin-top: 50px;
            background-color: #f8F8F8;
        }
        body{
            background-color: #FAFAFA;
        }
    </style>
  </head>
  <body>
    <div class="container">
    	<div class="row clearfix">
    	    <div class="col-md-12 column">
    		 	<nav class="navbar navbar-default" role="navigation">
    		 		<div class="navbar-header">
    		 			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                             <span class="sr-only">Toggle navigation</span>
                             <span class="icon-bar"></span>
                             <span class="icon-bar"></span>
                             <span class="icon-bar"></span>
    					</button>
                        <img src="http://localhost:8080${pageContext.request.contextPath}/img/label.jpg" class="navbar-brand" style="">
    		 		</div>
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    		 		    <ul class="nav navbar-nav navbar-right">
                            <li>
                                <a href="${pageContext.request.contextPath}/index.jsp">首页</a>
                            </li>
                            <li class="active">
                                <c:if test="${sessionScope.user!=null}">
                                    <a href="${pageContext.request.contextPath}/api/task/show.do">任务</a>
                                </c:if>
                                <c:if test="${sessionScope.user==null}">
                                    <a href="${pageContext.request.contextPath}/safety/usertasklist.jsp">任务</a>
                                </c:if>
                            </li>
                            <li>
                                <a href="${pageContext.request.contextPath}/api/question/showAll.do">题库</a>
                            </li>
                            <li>
                                <c:if test="${sessionScope.user==null}">
                                    <a href="${pageContext.request.contextPath}/login.jsp">登陆</a>
                                </c:if>
                                <c:if test="${sessionScope.user!=null}">
                                    <a href="${pageContext.request.contextPath}/safety/my.jsp">我的</a>
                                </c:if>
                            </li>
                        </ul>
    		 		</div>
    		 	</nav>
    		</div>
    	</div>
    	<div class="col-lg-offset-2 col-lg-8">
             <div class="form-group">
                    <label for="input1">任务ID：</label>
                   <input type="text" class="form-control" disabled="disabled" value="${currtask.id}" id="input1"/>
             </div>
             <div class="form-group">
                   <label for="input2">任务名称：</label>
                   <input type="text" class="form-control" disabled="disabled" value="${currtask.title}" id="input2"/>
             </div>
             <div class="form-group">
                <label for="input3">任务日期：</label>
                <input type="text" class="form-control" disabled="disabled" value="${currtask.ctime}" id="input3"/>
             </div>
             <c:if test="${item.size()>0}">
                 <c:forEach items="${item}" var="q">
                     <blockquote>
                        <p>
                            ${q.title}
                        </p>
                        <p style="color: red">
                            ${q.uanswer}
                        </p>
                         <c:if test="${q.flag != 1}">
                             <p>
                                 参考答案：<br>
                                 ${q.answer}
                             </p>
                         </c:if>
                        <small><cite>${q.flag==1?"未完成":"已完成"}</cite></small>
                     </blockquote>

                 </c:forEach>
             </c:if>
             <c:if test="${item.size()==0}">
                 <form role="form" method="post" action="${pageContext.request.contextPath}/api/taskitem/add.do">
                     <input type="hidden" value="${currtask.id}" name="tid"/>
                     <input type="hidden" value="${currtask.nums}" name="nums"/>
                     <c:forEach var="i" begin="1" end="${currtask.nums}">
                        <div class="form-group">
                           <label for="inpu2">试题编号：</label>
        
                           <select class="form-control" name="qid${i}" id="inpu2">
                                <c:forEach items="${sessionScope.qlist}" var="q">
                                    <option value="${q.id}">${q.title}</option>
                                </c:forEach>
                           </select>
                        </div>
        
                     </c:forEach>
                     <input type="submit" class="btn btn-primary" value="新增任务详情">
                 </form>
             </c:if>

    	</div>
    </div>
  </body>
</html>